﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="房产销冠, 房地产,卡考网络" />
    <meta name="description" content="上海卡考网络有限公司" />
    <title>房产销冠</title>
    <link rel="stylesheet" href="css/list.css" type="text/css" />
    <link rel="stylesheet" href="css/global.css" type="text/css" />
    <link href="bootstrap/iCheck-master/skins/minimal/Orange.css" rel="stylesheet" type="text/css" />
    <!--<script src="js/jquery-1.8.3.min.js"></script>-->
    <!--<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />-->
    <script src="http://dn-blqw.qbox.me/jq+bs+art.js" type="text/javascript"></script>
    <!--<script src="js/jquery.easydropdown.min.js"></script>-->
    <!--<script src="bootstrap/iCheck-master/icheck.js"></script>-->
    <!--<script src="bootstrap/js/bootstrap.min.js"></script>-->
    <!--<script src="js/checkbox.js"></script>-->
    <script src="js/common.js"></script>
    <script src="js/PageIndex.js"></script>
    <script src="http://dn-blqw.qbox.me/kk.js"></script>
</head>
<body style="background: #f1f1f1;">
    <div class="main01">
        <div class="content clearfix">
            <div class="headline02">
                <div class="line_left">权限管理<span>(<b id="RecordCount">0</b>)</span></div>
                <div class="line_right">
                    <ul class="nav_line_right">
                        <li class="con"><a href="#">首页</a></li>
                        <li>/</li>
                        <li class="con"><a href="#">系统管理</a></li>
                        <li>/</li>
                        <li class="con"><a href="#" style="color: #60b12a;">权限管理</a></li>
                    </ul>
                </div>
            </div>
            <div class="bton">
                <div class="bton_left">
                    <div class="bton_left_nav">
                        <select id="F_CityKid" class="selall sel100 fl" style="margin-right:11px;">
                            <option value="-1">请选择</option>
                        </select>
                        <select id="F_IsOpen" class="selall sel100 fl" style="margin-right:11px;">
                            <option value="-1">是否开通</option>
                            <option value="0">未开通</option>
                            <option value="1">已开通</option>
                        </select>
                        <div class="fl mr10 fs14">用户名:</div>
                        <input type="text" class="selall sel100 fl" id="F_LoginName" name="F_LoginName" style="margin-right:11px;" />
                        <input type="button" value="搜索" class="sbtn fl" onclick="f_Seach()" />
                    </div>
                </div>
                <div class="bton_right">
                    <div class="bton_left_nav">
                        <a href="Auth_Edit.html" class="btn_add last" target="rightMain">添加</a>
                    </div>
                    <div class="bton_left_nav pageIn2">
                    </div>
                </div>
            </div>
        </div>
        <div style="min-height: 500px;">
            <div style="min-width: 800px; overflow: auto;">
                <table class="table01" style="width: 100%; max-height: 400px; table-layout: fixed; border-bottom: 1px #e6e6e6 solid;">
                    <thead>
                        <tr class="info_title">
                            <th style="width: 60px;">序号</th>
                            <th class="mid_line">用户名</th>
                            <th class="mid_line">开通城市</th>
                            <th class="mid_line">权限级别</th>
                            <th class="mid_line">是否开通</th>
                            <th class="mid_line">开通/关闭时间</th>
                            <th style="width: 150px" class="mid_line">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr class="info_cont" style="display: none">
                            <td>{F_Index}</td>
                            <td>{F_LoginName}</td>
                            <td>{F_CityName}</td>
                            <td>{F_AuthorityID}</td>
                            <td>{F_IsOpen}</td>
                            <td>{F_UpdateTime}</td>
                            <td>{F_Operate}</td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <!--放置分页 begin -->
            <table style="width: 100%; height: auto">
                <tr>
                    <td colspan="15">
                        <div class="pageIn"></div>
                    </td>
                </tr>
            </table>
            <!--放置分页 end -->
        </div>
    </div>
    <script type="text/javascript" src="js/list.js"></script>
    <script type="text/javascript">
        var PageIndex = 1;
        var PageSize = 8;
        function f_Seach()
        {
            f_GetData(1);
        }

        var requestData =function() {
            var cityKid = $("#F_CityKid option:selected").val();
            if (isNaN(cityKid) || cityKid == "") {
                cityKid = -1;
            }

            var isOpen = $("#F_IsOpen option:selected").val();
            if (isNaN(isOpen) || isOpen == "") {
                isOpen = -1;
            }

            var loginName = $("#F_LoginName").val();

            var data = {
                pageIndex: PageIndex,
                pageSize: PageSize,
                cityKid: cityKid,
                isOpen: isOpen,
                loginName: loginName
            };
            return data;
        }
        
        //获取商品详细
        function f_GetData(pageIndex) {
            var idx = 0;
            $kk.api.get("/PointStoreAuth/Auth_GetList", requestData(), function (res) {
                kk.fillTable(".table01", res.Items, function (data, name) {
                    switch (name) {
                        case "F_Index":
                            idx++;
                            var otherCount = PageSize * (pageIndex - 1);
                            if (isNaN(otherCount)) {
                                otherCount = 0;
                            }
                            return idx + otherCount;
                        case "F_AuthorityID":
                            if (data[name] == 1) {
                                return "全国管理";
                            } else {
                                return "城市管理";
                            }
                            break;
                        case "F_IsOpen":
                            if (data[name] == 1) {
                                return "已开通";
                            } else {
                                return "未开通";
                            }
                            break;
                        case "F_Operate":
                            return "<div class='reset'><a href=\"javascript:;\" onclick=\"f_AuthEdit('" + data["Kid"] + "','" + data["F_LoginName"] + "','" + data["F_CityKid"] + "','" + data["F_IsOpen"] + "','" + data["F_AuthorityID"] + "')\" class=\"btn_revise\">权限变更</a></div>";
                    }
                });
                $("#RecordCount").html(res.Count);
                makePageBar(f_GetData, res.Count, pageIndex, PageSize);
                PageIndex=pageIndex;
            });
        }
        
        $(function () {
            f_GetData();
            f_GetCityList();
        });
        function f_GetCityList() {
            var data = kk.api.get("/PointStoreAuth/Auth_GetAuthCityList", function (data) {
                $("#F_CityKid").empty();
                $.each(data, function (i, obj) {
                    $("#F_CityKid").append("<option value='" + obj.F_CityKid + "'>" + obj.F_CityName + "</option>");
                });
            });
        }

        function f_AuthEdit(kid, loginName, cityKid, isOpen, authorityID)
        {            
            window.location = "/admin/Auth_Edit.html?loginName=" + loginName + "&cityKid=" + cityKid + "&isOpen=" + isOpen + "&kid=" + kid + "&authorityID=" + authorityID;
        }
    </script>
</body>
</html>
